<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="btn">隐藏</button>
    <br>
    <img id="new"  src="img/2.jpg" alt="" width="300px" height="300px"> 
    <script>
        var obtn=document.getElementById('btn');
        var newImg=document.getElementById('new');
        obtn.onclick=function(){
            if(obtn.innerHTML==='隐藏'){
                newImg.style.display='none';
                obtn.innerHTML='显示';
            }else{
                newImg.style.display='block';
                obtn.innerHTML='隐藏';
            }
            
        }
    </script>
</body>
</html>